package thinkingJava.chapter19;
import static util.Print.*;

import java.util.Random;

import thinkingJava.chapter15.Generator;
enum CartoonCharacter implements Generator<CartoonCharacter> {
	SLAPPY, SPANKY, PUNCHY, SILLY, BOUNCY, NUTTY, BOB;
	private Random rand = new Random(47);
	public CartoonCharacter next() {
		return values()[rand.nextInt(values().length)];
	}
}
public class EnumImplemetation {
	public static <T> void printNext(Generator<T> gr) {
		printnb(gr.next() + " ,");
	}
	public static void main(String[] args) {
		CartoonCharacter cc = CartoonCharacter.BOB;
		for (int i = 0; i < 10; i ++) {
			printNext(cc);
		}
	}
}
